package com.example.curriculum.controller;

import com.example.curriculum.pojo.OutBound;
import com.example.curriculum.pojo.ResponseMessage;
import com.example.curriculum.service.OutBoundService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/OutBound")
public class OutBoundController {
    @Resource
    private OutBoundService outBoundService;

    @PostMapping
    public ResponseMessage<OutBound> add(@Validated  @RequestBody OutBound outbound){
        OutBound outboundnew = outBoundService.add(outbound);
        return ResponseMessage.success(outboundnew);
    }
    @GetMapping("/{bill_id}")
    public ResponseMessage<OutBound> select(@PathVariable String bill_id){
        OutBound outboundnew = outBoundService.select(bill_id);
        return ResponseMessage.success(outboundnew);
    }
    @PutMapping
    public ResponseMessage<OutBound> update(@Validated  @RequestBody OutBound outbound){
        OutBound outboundnew = outBoundService.update(outbound);
        return ResponseMessage.success(outboundnew);
    }
    @DeleteMapping("/{bill_id}")
    public ResponseMessage<OutBound> delete(@PathVariable String bill_id){
        outBoundService.delete(bill_id);
        return ResponseMessage.success();
    }
}
